<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title th:text="${session.title}">123</title>
    <link th:replace="common/header"/>
    <link rel="stylesheet" th:href="@{/css/ace-skins.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/jquery.autocomplete.css}"/>
</head>
<body class="navbar-fixed">
<div th:replace="common/top"></div>
<div class="container-fluid main_bg" id="main-container">
    <a id="menu-toggler" href="#"><span></span></a>
    <div th:replace="common/menu"></div>
    <div id="main-content" class="clearfix">
        <div id="page-content" class="clearfix">
            <div th:replace="common/title"></div>
            <h3 class="header smaller lighter blue"><em class="icon-plus"></em>添加热身赛报分</h3>
            <form class="form-horizontal" th:object="${footBfinfo}" method="post" th:action="@{/hy/footBfinfo/add}"
                  name="form" autocomplete="off">
                <input type="hidden" name="bflx" th:field="*{bflx}"/>
                <input type="hidden" name="qd1" th:field="*{qd1}"/>
                <input type="hidden" name="jq2" th:field="*{jq2}"/>
                <div class="row-fluid">
                    <div class="span7">
                        <table id="table_bug_report" class="table table-hover">
                            <thead>
                            <tr>
                                <th>用户昵称</th>
                                <th style="width:60px;">胜次数</th>
                                <th style="width:60px;">平次数</th>
                                <th style="width:60px;">负次数</th>
                                <th class="hidden-480" style="width:60px;">胜率</th>
                                <th style="width:60px;">积分</th>
                                <th class="hidden-480" style="width:60px;">比赛场次</th>
                                <th class="hidden-480" style="width:60px;">信用度</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="t:${qdList}" th:unless="${t.userName == session.footUser.nike}">
                                <td th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'">
                                    <img th:src="@{/images/vip.png}" alt="" src="" th:if="${t.vipType == '会员'}"/>
                                    <img th:src="@{/images/vip1.png}" alt="" src="" th:if="${t.vipType == 'VIP1'}"/>
                                    <img th:src="@{/images/vip2.png}" alt="" src="" th:if="${t.vipType == 'VIP2'}"/>
                                    <img th:src="@{/images/vip3.png}" alt="" src="" th:if="${t.vipType == 'VIP3'}"/>
                                    <span th:text="${t.userName}">123</span></td>
                                <td th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${t.s}">123
                                </td>
                                <td th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${t.p}">123
                                </td>
                                <td th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${t.f}">123
                                </td>
                                <td class="hidden-480"
                                    th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${#numbers.formatPercent(t.sl, 1, 0)}">123
                                </td>
                                <td th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${t.jf}">123
                                </td>
                                <td class="hidden-480"
                                    th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${t.bscc}">123
                                </td>
                                <td class="hidden-480"
                                    th:onclick="'javascript:changePerson(' + ${t.userId} + ',\'' + ${t.userName} + '\')'"
                                    th:text="${#numbers.formatDecimal(t.xyd, 0, 0)}">123
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="span5">
                        <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                            <div class="span12">
                                <div class="control-group">
                                    <label class="control-label">玩家:<span style="color:red">*</span></label>
                                    <div class="controls" th:text="${footBfinfo.qd1Name}">123</div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label" for="jq1">结果:<span style="color:red">*</span></label>
                                    <div class="controls">
                                        <label class="span3 Light">
                                            <input type="radio" name="jq1" id="jq1" value="2"/>
                                            <span class="lbl">胜</span>
                                        </label>
                                        <label class="span3 Light">
                                            <input type="radio" name="jq1" value="1"/>
                                            <span class="lbl">平</span>
                                        </label>
                                        <label class="span3 Light">
                                            <input type="radio" name="jq1" value="0"/>
                                            <span class="lbl">负</span>
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <span style="color:red" th:if="${#fields.hasErrors('qd1')}" th:errors="*{qd1}">Name Error</span>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <div class="control-group">
                                    <label class="control-label" for="selectqd">玩家:<span
                                            style="color:red">*</span></label>
                                    <div class="controls">
                                        <input type="hidden" name="qd2" id="qd2" th:field="*{qd2}"/>
                                        <input type="text" name="selectqd" id="selectqd" class="input_fix"
                                               autocomplete="false" placeholder="从列表选择或输入查询"/>
                                    </div>
                                </div>
                            </div>
                            <div class="span6">
                                <span style="color:red" th:if="${#fields.hasErrors('qd2')}" th:errors="*{qd2}">Name Error</span>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span12">
                                <span style="color:red">若下拉框无玩家信息，请手动输入玩家名称，本搜索支持模糊查询或者双击文本框</span>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="text-center span12">
                                <button class="btn btn-primary" type="submit"><em class="icon-save"></em>提交</button>
                                <button class="btn btn-danger" type="reset"><em class="icon-remove"></em>取消</button>
                                <a class="btn" type="button" th:href="@{/index}"><em
                                        class="icon-arrow-left"></em>返回首页</a>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <!--/#page-content-->
        </div>
        <div th:replace="common/skin :: skin"></div>
    </div><!--/#main-content-->
</div><!--/.fluid-container#main-container-->
<div th:replace="common/js"></div>
<script type='text/javascript' th:src='@{/js/jquery.autocomplete.min.js}'></script>
<script type='text/javascript' th:src='@{/js/jquery-migrate-1.4.1.min.js}'></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#jq1").attr("checked", "checked");
        var search = [];
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footBfinfo/searchUser",
            success: function (data) {
                search = data;
                $("#selectqd").autocomplete(search, {
                    minChars: 0,
                    width: $("#selectqd").width() + 10,
                    //matchContains: "word",
                    autoFill: false,
                    formatItem: function (row, i, max) {
                        return row.nike;
                    },
                    formatMatch: function (row, i, max) {
                        return row.nike;
                    },
                    formatResult: function (row) {
                        return row.nike;
                    }
                });
            }
        });
        $("#selectqd").result(function (event, data, formatted) {
            $("#qd2").val(data.id);
        });
    });

    function changePerson(id, name) {
        $("#qd2").val(id);
        $("#selectqd").val(name);
    }
</script>
</body>
</html>
